<include file="Common:pony" />
<body>

<table width="100%">
<tr>
<th>ID</th>
<th>昵称</th>
<th>内容</th>
<th>时间</th>
<th>操作</th>
</tr>

<volist name="tradefeedback" id="vo">
<tr>
<td align="center"><{$vo['id']}></td>
<td align="center"><{$vo['seller_nick']}></td>
<td align="center"><{$vo['fcontent']}></td>
<td align="center"><{$vo['addtime']}></td>
<td align="center"> <input type="button" value="回复" fid="<{$vo['id']}>" id="btnFeedback_<{$vo['id']}>"></td>
</tr>
</volist>

</table>

<div id="fbox" style="width:800px; margin:10px auto;">
处理内容<input type="text" style="width:600px; height:30px" name="fcontent" id="fcontent" />
<input type="button" value="提交" name="button1" id="btnSave" />
<input type="hidden" name="fid" id="fid" value="0">
<div style="font-family: 微软雅黑, Tahoma; letter-spacing: 2px; display: block;" id="result"></div>
</div>
<script>
$(document).ready(function(){
	$( '#fcontent' ).focus();
	
	$("#btnSave").bind('click', function(){
		var tid = <{$tid}>;
		var fid = parseInt($("#fid").val());
		var fcontent = $("#fcontent").val();
		if( fcontent == null || '' == fcontent ) {
			$('#result').html( '填写处理内容' ).show();
			$( '#fcontent' ).focus();
			return false ;
		}
		try {
			
		
			$.post( '<{:U('Index/tradefeedbacksave')}>' , {
					tid : tid, fcontent: fcontent ,  fid : fid 
				}, 
				function(data){
					if( 1 == data['status'] ){
						$('#result').html( data['info'] ).show().fadeOut(2000);
						var _t = window.parent ;
						_t.document.getElementById('toTalk_' + tid ).src =  '<{:__PUBLIC__}>/images/talk_on.png';
					}else {
						$('#result').html('提交失败 '+ data['info'] );	
					}
					
				} 
			);
		} catch(e){}
		$("#fid").val( 0 );
	} );
	
	
	$("input[id^='btnFeedback']").bind('click', function(){
		var fbox = $("#fbox");
		var fid = $(this).attr('fid');
		$("#fid").val( fid );
		
		fbox.fadeOut().fadeIn();
		
	});
	
	$("#btnCancelFeedback").bind('click', function(){
		var tid = <{$tid}>;
		if(window.confirm('真的要取消处理？')){
			$.post('<{:U('Index/tradefeedbackcancel')}>' , {
				tid : tid
				
			} , function(data){
				if( 1 == data['status'] ){
					alert( data['info'] );
				}else {
					alert('提交失败 '+ data['info'] );	
				}
			} );
			
		}
		
	});
});
</script>
</body>
</html>